package Dame;

import java.util.ArrayList;
import java.util.stream.Stream;

public class test3 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        list.add("小鲁");
        list.add("中鲁");
        list.add("大鲁");
        list.add("小小鲁");
        list.add("小小鲁");

        Stream<String> limit = list.stream().limit(2);
        limit.forEach(s -> System.out.println(s));
        System.out.println("--------------");
        Stream<String> skip = list.stream().skip(2);
        skip.forEach(s -> System.out.println(s));
        System.out.println("--------------");
        Stream<String> distinct = list.stream().distinct();
        distinct.forEach(s -> System.out.println(s));
        System.out.println("--------------");
        ArrayList<String> list1 = new ArrayList<>();
        list1.add("小鲁");
        list1.add("中鲁");
        list1.add("大鲁");
        list1.add("小小鲁");
        list1.add("小小鲁");
        Stream<String> list2 = list.stream();
        Stream<String> list3 = list1.stream();
        Stream.concat(list2,list3).forEach(s -> System.out.println(s));
    }
}
